<?php $this->headScript()->appendFile(HTTP_HOST.'/js/site-manager/objects.js'); ?>

<?php if (true || sizeof($this->objects) > 0) { ?>
<?php $i = 1;?>
<div id="cat_table_div">
<table id="cat_table">
	<tr class="head">
		<td class="checkbox_td"></td>
		<td><?=$this->translate('Код')?></td>
		<td></td>
		<td><?=$this->translate('Объект')?></td>
		<td>-</td>
		<td>-</td>
		<td>-</td>
		<td><?=$this->translate('Сортировка')?></td>
		<td colspan="2" class="right_angle"></td>
	</tr>
	<tr class="table_footer cl">
		<td colspan="10" id="footer_ico">
		<div id="table_paging_div"><?=$this->paginationControl($this->objects, 'Sliding', 'pagination.phtml'); ?></div>
		<div id="_add_new_object_div"><a href="<?=$this->url(array('controller' => 'object', 'action' => 'edit', 'addnew' => 1))?>"><img src="<?=HTTP_HOST;?>/images/admin-side/add.png" alt="" class="add_sign"/><?=$this->translate('Добавить объект')?></a></div>
		</td>
	</tr>
	<tr id="subhead">
		<td class="checkbox_td"><input type="checkbox" class="enable_all"></td>
		<td class="_table_code"><input type="text" name="code" id="code_field" maxlength="10" value="<?=$this->id?>"/>
		<script type="text/javascript">
		$('#code_field').keydown(function(event) {
			  if (event.keyCode == '13') {
			     event.preventDefault();
			     window.location.href = HTTP_HOST + '/site-manager/object/index/id/' + $(this).val();
			   }
			});
		</script>
		</td>
		<td>-</td>
		<td><input type="text" name="search_region" id="search_region" maxlength="255" value="<?=$this->objname?>"/>
		<script type="text/javascript">
		$('#search_region').keydown(function(event) {
			  if (event.keyCode == '13') {
			     event.preventDefault();
			     window.location.href = HTTP_HOST + '/site-manager/object/index/objname/' + $(this).val();
			   }
			});
		</script>
		</td>
		<td class="active_td">-</td>
		<td class="_table_sort_td">-</td>
		<td class="_table_sort_td">-</td>
		<td class="_table_sort_td">-</td>
		<td colspan="2" class="search_image"><img src="<?=HTTP_HOST; ?>/images/controll/zoom.png" alt="" class="zoom_icon"/></td>
	</tr>	
	<?php foreach ($this->objects as $v) { ?>
		<?php $i++;?>
		<tr class="cl" <?=(!is_int($i/2))?"style='background: #e1e0e0;'":""; ?>>
			<td class="checkbox_td"><input type="checkbox" name="<?=$v['ID']?>" class="object_ch"></td>
			<td class="_table_code"><?=$v['ID']?></td>
			<?php $id = $v['ID']; ?>
			<td class="type_td"><img src="<?=HTTP_HOST; ?>/images/controll/file.png" alt="" class="object_type" id="state-<?=$v['ID']?>"/></td>
			<td class="_table_title"><?=stripslashes($v['Name'])?></td>
			<td class="active_td"><img src="<?=HTTP_HOST; ?>/images/controll/<?=$v['Active'] == 0 ? 'inactive.png' : 'active.png'?>" alt="" class="state1" id="state-<?=$v['ID']?>" title="<?=$v['Active'] == 0 ? $this->translate('Не активный') : $this->translate('Активный')?>"/></td>
			<td class="edit_td"><img src="<?=HTTP_HOST; ?>/images/controll/item.png" alt="" class="same_obects" title="<?=$this->translate('Сопутствующие обьекты')?>" id="same_<?=$v['ID'];?>"/></td>
			<td class="edit_td"><img src="<?=HTTP_HOST; ?>/images/controll/special.png" alt="" class="spec_offer_btn" title="<?=$this->translate('Специальное предложение')?>" id="act_<?=$v['ID'];?>"/></td>
			<td class="_table_sort_td"><input type="text" class="sort_field" name="Sort" value="<?=$v['Sort']?>"></td>
			<td class="edit_td"><a href="<?=$this->url(array('controller' => 'object', 'action' => 'edit', 'id' => $v['ID']), null, false)?>"><img src="<?=HTTP_HOST; ?>/images/controll/edit.png" alt="" class="ed-del-btn1" title="<?=$this->translate('Редактировать объект')?>"/></a></td>
			<td class="del_td"><div id="<?=$v['ID']?>" class="del_o" rel="<?=$v['Name']?>" ><img src="<?=HTTP_HOST; ?>/images/controll/delete.png" alt=""  class="ed-del-btn1" title="<?=$this->translate('Удалить объект')?>"/></div></td>
		</tr>
	<?php } ?>
	<tr class="table_footer cl">
		<td id="ch" class="checkbox_td"><input type="checkbox" class="enable_all"></td>
		<td colspan="9" id="footer_ico"><div id="group_delete" style="margin: 0px 0px 0px 5px;"><img src="<?=HTTP_HOST; ?>/images/controll/delete.png" alt=""  class="ed-del-btn"/><div id="delete_label"  style="left: 4px;"><?=$this->translate('Удалить')?></div></div>
		<div id="table_paging_div"><?=$this->paginationControl($this->objects, 'Sliding', 'pagination.phtml'); ?></div>
		<div id="_add_new_object_div"><a href="<?=$this->url(array('controller' => 'object', 'action' => 'edit', 'addnew' => 1))?>"><img src="<?=HTTP_HOST;?>/images/admin-side/add.png" alt="" class="add_sign"/><?=$this->translate('Добавить объект')?></a></div>
		</td>
	</tr>
</table>
<div id="table_shadow"></div>
</div>
<?php } else {?>

<div id="_add_new_object_div"><a href="<?=$this->url(array('controller' => 'object', 'action' => 'edit', 'addnew' => 1))?>"><img src="<?=HTTP_HOST;?>/images/admin-side/add.png" alt="" class="add_sign"/><?=$this->translate('Добавить объект')?></a></div>
<?php }?>
